#!/bin/bash
CURRENT_PATH=$(pwd);
ROOT_PATH=$(cd `dirname $0`/; pwd);

TARGET=$1

if [[ -z ${TARGET} ]]
then
  # 默认平台
  TARGET=base
fi

if [[ -e ${ROOT_PATH}/nginx.conf ]]
then
    cp -f ${ROOT_PATH}/nginx.conf /etc/nginx/conf.d/go-instance-${TARGET}-${ENV}.conf
    service nginx reload
fi

if [[ -e ${ROOT_PATH}/game.conf ]]
then
  mkdir -p /etc/nginx/game/
  cp -f ${ROOT_PATH}/game.conf /etc/nginx/game/${TARGET}-${ENV}.conf
  mkdir -p /etc/nginx/game-socket/
  cp -f ${ROOT_PATH}/game-socket.conf /etc/nginx/game-socket/${TARGET}-${ENV}.conf
  service nginx restart
fi